import axios, { AxiosStatic } from 'axios'
// 基础配置
const defaultConfig = {
  baseURL: import.meta.env.VITE_API_BASE_URL,
  timeout: 60000,
  access: true,
  changeOrigin: true,
  withCredentials: true,
  headers: {
    'X-Requested-With': 'XMLHttpRequest',
    'Content-Type': 'application/json',
    'content-encoding': 'gzip',
  },
}

// eslint-disable-next-line no-underscore-dangle
const _axios = axios.create(defaultConfig) as AxiosStatic
//! 挂载axios中断请求的实例
_axios.CancelToken = axios.CancelToken

export default _axios
